<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<script language="javascript"> 
function toggle(str) {
	var ele = document.getElementById(str);

	if(ele.style.display == "") {
		ele.style.display = "none";
  	}
	else {
		ele.style.display = "";
	}
}

function test(source){
	var id = source.id;
	
	var idSp = id.split("_");
	
	if(idSp[0] == 'ismMgr'){
		$('#ismgr_'+idSp[1]+"_"+idSp[2]).prop('checked',false);
		$('#issc_'+idSp[1]+"_"+idSp[2]).prop('checked',false);
		$(".ismMgr_"+idSp[1]).prop('checked',false);
		$("#"+id).prop('checked',true);
		checkboxradio('refresh');
	}else if(idSp[0] == 'ismgr'){
		$('#ismMgr_'+idSp[1]+"_"+idSp[2]).prop('checked',false);
		$('#issc_'+idSp[1]+"_"+idSp[2]).prop('checked',false);
		$(".ismgr_"+idSp[1]).prop('checked',false);
		$("#"+id).prop('checked',true);
		checkboxradio('refresh');
	}else if(idSp[0] == 'issc'){

		$('#ismgr_'+idSp[1]+"_"+idSp[2]).prop('checked',false);
		$('#ismMgr_'+idSp[1]+"_"+idSp[2]).prop('checked',false);

		checkboxradio('refresh');
	}
	
}
</script>
</head>
<body style="font-family:Arial, Helvetica, sans-serif; line-height:20px;">
<h1>
  <br />
  Team bonus staff List
  <br />
  <br />
  <?php echo $this->dateBegin."  to ".$this->dateEnd." ( ".$this->cycle." )"; ?>
<br />
</h1><form action="" method="post">
<?php $groupShops = unserialize(ARR_SHOP_GROUP);
	  $stInfo = new Model_DbTable_Roster_Staffinfo();
	  $tBonus = new Model_Payroll_Shopgroupbonusrecord();?>
	  
<?php foreach($this->arrList as $key => $val){?>
<br/>
<h3><a href = "javascript:toggle('dT<?=$key?>');"><?php echo 'Shop: '.$groupShops[$key]." $".$val['bonus'][0];?></a></h3>
<input type = 'hidden' name = "group_code[<?php echo $key?>]" id = "group_code[<?php echo $key?>]" value = "<?php echo $key;?>"></input>
<div id = "dT<?=$key?>" style="display:none;">
<table width="800" border="1" cellspacing="0" cellpadding="10">
  <tr>
    <th scope="col">ID</th>
    <th scope="col">Staff</th>
    <th colspan="4" scope="col">Position</th>
    <th scope="col">WkHr</th>
  </tr>
  <?php foreach ($val['wk'] as $k => $v){
  	if($k != 4){?>
  <tr>
    <td><?php echo $k ?></td>
    <?php $stf = $stInfo->getStaffinfo($k);?>
    <td><a target="_blank" href="/rosteraudit/update-person-info/stid/<?php echo base64_encode($k); ?>"><?php echo $this->arrStName[$k];?></a> (<?php
	$stDetail = new Model_DbTable_Roster_Stafflogindetail();
	$stLine = $stDetail->getDetail($k);
	echo $stLine['ni'];
    ?>)</td>
    <td>     <?php if(in_array($k,$val['sc']) || in_array($k,$val['manager'])){?>
    <input name="is_mMgr[<?php echo $key ?>][<?php echo $k?>]" type="radio" value="<?php echo $k ?>" id = "ismMgr_<?php echo $key?>_<?php echo $k;?>" class = "ismMgr_<?php echo $key?>" onclick = "test(this)"/> IS Multi Mgr
    <?php }?>  </td>
    <td>
    <?php if(in_array($k,$val['manager']) || in_array($k,$val['sc']) ){?>
    <input name="is_mgr[<?php echo $key ?>][<?php echo $k?>]" type="radio" value="<?php echo $k ?>" id = "ismgr_<?php echo $key?>_<?php echo $k;?>"  class = "ismgr_<?php echo $key?>" onclick = "test(this)"/> IS Mgr
    <?php }?>
    </td>
    <td>     <?php if(in_array($k,$val['sc']) || in_array($k,$val['manager'])){?>
    <input name="is_sc[<?php echo $key ?>][<?php echo $k?>]" type="radio" value="<?php echo $k ?>" id = "issc_<?php echo $key?>_<?php echo $k;?>" class = "issc_<?php echo $key?>" onclick = "test(this)"/> IS SC
    <?php }?>  </td>
    
    <td>  <input name="is_ft[<?php echo $key ?>][<?php echo $k ?>]" type="checkbox" value="<?php echo $v;?>" checked/> 
    Full Time<?php if($stf['leave'] == 9){echo "<img src=\"/im/gone.jpg\" />";}?></td>
    <td><?php echo $v;?></td>
  
  </tr>
  <?php }?>
  <?php }?>
</table>
</div>
<?php } ?>
<br />
<input name="" type="submit" />
</form>
<div id = "payrollWizard" <?php if(!$this->nextCheck){?>style = "visibility:hidden;<?php }?>">
<input type = "submit" name = "next" id = "next" value = "Next" style = "margin-left:650px;" onclick= "transfer('<?php echo $this->dateBegin;?>','<?php echo $this->dateEnd;?>')"></input>
</div>
<script type="text/javascript">
function transfer(date_begin,date_end){
	window.location.href = 'http://<?php echo WEB_IP?>/staff/team-bonus-wizard-confirm/date_begin/'+ date_begin + '/date_end/' + date_end + '/next/yes';
}
</script>
</body>
</html>